package com.sy.demo.xstream;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;

public class Test {

	public Test() {
	}

	/**
	 * Description: 
	 * @Version1.0 11-Jun-09 11:48:50 AM by 孙玮男（sun_sy@188.com）创建
	 * @param args
	 */
	public static void main(String[] args) {
		
		Person person = new Person();
		person.setAge(30);
		person.setName("SUN");
		
		XStream xs = new XStream(new DomDriver());
		xs.alias("Person", Person.class);
		String xmlstr = xs.toXML(person);
		System.out.println(xmlstr);
		
		
		
		
		Person p = (Person)xs.fromXML(xmlstr);
		
		System.out.println(p.getAge());
		System.out.println(p.getName());
	}

}
